package com.ftf.tp.common.constants;

import com.ftf.tp.common.core.exception.BusinessException;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author tanghao
 * @date 2022/9/16
 */
@Getter
@AllArgsConstructor
public enum NoticeTypeEnum {

    /**
     * 通知类型枚举
     */
    SUPPORT("support", "supportNoticeImpl"),

    ;


    private final String code;

    private final String impl;


    public static String implByCode(String code) {
        for (NoticeTypeEnum noticeTypeEnum : NoticeTypeEnum.values()) {
            if (noticeTypeEnum.getCode().equals(code)) {
                return noticeTypeEnum.getImpl();
            }
        }

        throw new BusinessException("未找到对应的code=" + code);
    }
}
